package com.yifeng.repo.controller.fadada.configure;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;

/**
 * Created by daibing on 2024/11/23.
 */
@Data
@ConfigurationProperties(prefix = FadadaProperties.PREFIX)
public class FadadaProperties {

    public static final String PREFIX = "yfcloud.controller.fadada";

    /**
     * 是否启用审核状态机
     */
    private boolean enableFadadaSignature = false;

    /**
     * 电子签章appId
     */
    private String fadadaAppId;

    /**
     * 电子签章应用名称
     */
    private String fadadaAppName;

    /**
     * 电子签章应用秘钥
     */
    private String fadadaAppSecret;

    /**
     * 电子签章平台url
     */
    private String fadadaUrl;

    /**
     * 回调地址前缀
     */
    private String callbackPrefix = "/callback/fadada";

    /**
     * 超时时间
     */
    private Integer readTimeout = 30;
    private Integer writeTimeout = 30;
    private Integer fileReadTimeout = 120;
    private Integer fileWriteTimeout = 120;

    /**
     * 个人实名认证套餐类型
     */
    private String verifiedWayPerson = "4";

    /**
     * 企业实名认证套餐类型
     */
    private String verifiedWayCompany = "2";

    /**
     * 企业管理员认证套餐类型
     */
    private String verifiedWayAdmin = "1";

    /**
     * 版本
     */
    private String version = "2.0";

    /**
     * 电子签章位置配置
     */
    private List<SignaturePosition> signaturePositions;

    /**
     * 是否启用admin API接口
     */
    private boolean enableAdminApi = false;

    /**
     * admin API地址前缀
     */
    private String adminApiPrefix = "/fadada";

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class SignaturePosition {

        /**
         * 自定义code，对应一个签章位置
         */
        @JsonIgnore
        private String code;

        @JsonProperty("pagenum")
        private int pageNum = 0;

        private int x;

        private int y;
    }

}
